@using CodeGenerator.Entity.Dto;
@using CodeGenerator.Util;

@{
    Layout = "~/Areas/Admin/Views/Shared/_Layout_List.cshtml";

    var obj = (Scm_ProductDto)Model;
    var objStr = Html.Raw(obj.ToJson());
}

<form id="dataForm" enctype="multipart/form-data" class="easyui-form" method="post" data-options="novalidate:true">
    <table class="table_base">
        <colgroup>
            <col style="width:80px;" />
        </colgroup>
        <tbody>
            
           
            <tr>
                <th>产品名称</th>
                <td>
                    <input name="ProductName" value="@obj.ProductName" class="easyui-textbox" data-options="width:'200px',required:true">
                </td>
            </tr>
            <tr>
                <th>成本价</th>
                <td>
                    <input name="CostPrice" value="@obj.CostPrice" class="easyui-textbox" data-options="width:'200px',required:true">
                </td>
            </tr>
            <tr>
                <th>排序</th>
                <td>
                    <input name="Sort" value="@obj.Sort" class="easyui-textbox" data-options="width:'200px',required:true">
                </td>
            </tr>
            <tr>
                <th>是否禁用</th>
                <td>
                    <select name="IsDisable" class="easyui-combobox" data-options="width:200,value:'@obj.IsDisable',required:true">
                        <option value="false">否</option>
                        <option value="true">是</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th>单位规格</th>
                <td>
                    <input name="Specification" value="@obj.Specification" class="easyui-textbox" data-options="width:'200px',required:true">
                </td>
            </tr>
            <tr>
                <th>品牌</th>
                <td>
                    <input name="Brand" value="@obj.Brand" class="easyui-textbox" data-options="width:'200px',required:true">
                </td>
            </tr>
            <tr>
                <th>产地</th>
                <td>
                    <input name="Place" value="@obj.Place" class="easyui-textbox" data-options="width:'200px',required:true">
                </td>
            </tr>
            <tr>
                <th>净重</th>
                <td>
                    <input name="Weight" value="@obj.Weight" class="easyui-textbox" data-options="width:'200px',required:true">
                </td>
            </tr>
            <tr>
                <th>存储条件</th>
                <td>
                    <input name="Conditions" value="@obj.Conditions" class="easyui-textbox" data-options="width:'200px',required:true">
                </td>
            </tr>
        </tbody>
    </table>
</form>

@section foottoolbar{
    <a id="saveForm" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-save'">保存</a>
}

<script>
    var rootUrl = '@Url.Content("~/")';
    var theEntity = @objStr;

    $(function () {
        $('#saveForm').click(function () {
            if (!$('#dataForm').form('enableValidation').form('validate'))
                return;

            var formValues = $('#dataForm').getValues();
            $.extend(theEntity, formValues);
            $.postJSON(rootUrl + 'Scm/Scm_Product/SaveData', theEntity, function (resJson) {
                if (resJson.Success) {
                    parent.dialogMsg('保存成功!');
                    parent.$('#dataTable').datagrid('clearChecked').datagrid('reload');
                    parent.dialogClose('form');
                }
                else {
                    dialogError(resJson.Msg);
                }
            });
        });
    });
</script>
